home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / tandem / teaching / 49.asm < prev    next >
Assembly Source File  |  1999-09-06  |  3KB  |  103 lines

  1. * 49.asm     TLreqshow II    version 0.01   8.6.99
  2.  
  3.  
  4.  include 'Front.i'
  5.  
  6.  
  7. ; This program demonstrates the use of TLreqshow to view classified data
  8. ; with dynamic contents
  9.  
  10.  
  11. strings: dc.b 0
  12.  dc.b 'View subset 0',0 ;1
  13.  dc.b 'Some Catalogued data (n.b. press <Help> for assistance)',0 ;2
  14.  dc.b '** Click one of the lines below to select which subset **',0 ;3
  15.  dc.b '** Click this line to return to the subset catalogue **',0 ;4
  16.  dc.b 'Subset 0 String     ',0 ;5
  17.  dc.b 'Error: out of memory',0 ;6
  18.  
  19.  ds.w 0
  20.  
  21.  
  22. subset: ds.w 1                   ;subset selected (-1 if in catalogue list)
  23.  
  24.  
  25. * test program
  26. Program:
  27.  TLwindow #-1
  28.  move.w #-1,subset               ;flag no subset is yet selected
  29.  TLreqshow #Hook,#2,#20,#20      ;hook=Hook title=2 lines=20 shown=20
  30.  rts
  31.  
  32. Pr_bad:
  33.  TLbad #6
  34.  rts
  35.  
  36.  
  37. * Act as hook for TLreqshow
  38. Hook:
  39.  tst.w subset         ;go if we are in one of the subsets
  40.  bpl.s Ho_sub         ;(if sub=-1, we are still in the catalogue list)
  41.  tst.l d0             ;go if a line clicked
  42.  bmi.s Ho_clkd
  43.  bne.s Ho_cat         ;go if d0>0
  44.  TLstrbuf #3          ;line 0: send string 3
  45.  move.l a4,a0
  46.  rts
  47.  
  48. Ho_cat:
  49.  cmp.w #5,d0          ;if D0>4, send blank line (lines 5-19 blank)
  50.  bcc.s Ho_null
  51.  TLstrbuf #1          ;send string 1
  52.  add.b d0,12(a4)      ;poke subset num in last chr
  53.  move.l a4,a0         ;a0=string to display
  54.  rts
  55.  
  56. Ho_null:
  57.  clr.b (a4)           ;send blank line
  58.  move.l a4,a0
  59.  rts
  60.  
  61. Ho_clkd:              ;catalogue list has been clicked
  62.  bclr #31,d0          ;d0=line clicked
  63.  tst.w d0
  64.  beq.s Ho_clkn        ;if line 0 was clicked, do nothing
  65.  cmp.w #5,d0
  66.  bcc.s Ho_clkn        ;if (blank) line 5-19 clicked, do nothing
  67.  move.w d0,subset     ;remember which subset clicked
  68.  moveq #3,d0          ;return from click: request redraw in subset
  69.  moveq #100,d1        ;each subset has 100 strings
  70.  moveq #0,d3          ;new topline
  71.  rts
  72.  
  73. Ho_clkn:              ;return from click: do nothing
  74.  moveq #-1,d0
  75.  rts
  76.  
  77. Ho_sub:               ;* we are in a subset
  78.  tst.l d0
  79.  bmi.s Ho_sclk        ;go if a subset line was clicked
  80.  bne.s Ho_some        ;go if string > 0
  81.  TLstrbuf #4
  82.  move.l a4,a0         ;string 0: send string 4
  83.  rts
  84.  
  85. Ho_some:
  86.  TLstrbuf #5          ;string 5 to buffer
  87.  move.w subset,d1
  88.  add.b d1,7(a4)       ;poke subset num into string
  89.  move.l a4,a0
  90.  add.l #16,a0         ;point to item num in subset
  91.  TLhexasc d0,a0       ;poke line num into string
  92.  move.l a4,a0
  93.  rts
  94.  
  95. Ho_sclk:              ;subset has been clicked
  96.  tst.w d0
  97.  bne Ho_clkn          ;do nothing unless 1st line clicked
  98.  move.w #-1,subset
  99.  moveq #3,d0          ;request redraw (back to catalogue window)
  100.  moveq #20,d1         ;items=20
  101.  moveq #0,d3          ;new topline
  102.  rts
  103.